package com.allenkerr.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created by 小柯 on 17/6/20.
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    private static final Logger LOGGER = LoggerFactory.getLogger(GlobalExceptionHandler.class);

    @ExceptionHandler(value = Exception.class)  //指定处理哪些异常信息
    public String handleException(Exception e) {
        LOGGER.error("系统异常！！！", e);
        return "系统繁忙，请稍后重试！";
    }
}
